import {Vector3} from "../math/Vector3";
import {Matrix4} from "../math/Matrix4";

export class Object3D {
    position: Vector3 = new Vector3();
    scale: Vector3 = new Vector3(1, 1, 1);
    rotation: Vector3 = new Vector3();

    getMatrix(): Matrix4 {
        const rx = new Matrix4().makeRotationX(this.rotation.x);
        const ry = new Matrix4().makeRotationX(this.rotation.y);
        const rz = new Matrix4().makeRotationX(this.rotation.z);
        const scale = new Matrix4().makeScale(this.scale.x, this.scale.y, this.scale.z);
        const transform = new Matrix4().makeTranslation(this.position.x,this.position.y, this.position.z);
        return transform.multiply(scale).multiply(rz).multiply(ry).multiply(rx);
    }
}